#include<stdio.h>
#include<stdlib.h>

int main(int argc,char** argv)
{
 unsigned char ip[4];
  printf("input IP:");
		scanf("%u.%u.%u.%u",&ip[0],&ip[1],&ip[2],&ip[3]);
		printf("get IP:%d.%d.%d.%d\n",ip[0],ip[1],ip[2],ip[3]);
		printf("define char arry,and use sprintf\n");
		unsigned char dstip[4]={0};
		sprintf(dstip,"%hc%hc%hc%hc",ip[0],ip[1],ip[2],ip[3]);
		printf("sprintf complete,result:%u.%u.%u.%u\n",dstip[0],dstip[1],dstip[2],dstip[3]);
  return 0;
}
